#include "CThreadShell.h"
#include "Main_constant.h"

#define	DDA_DMA_RXBUF_SIZE		120

uint8_t UART0_DMA_RXBUF[DDA_DMA_RXBUF_SIZE];
uint8_t UART1_DMA_RXBUF[DDA_DMA_RXBUF_SIZE];


extern void BspDdaRead(uint8_t* buf, uint32_t len);

void CThreadShell::Run(void){
    int recLen=0;
    while(true) {
        if(g_config.dda_uart_id==0){
            recLen=  Serial.available();
            if(recLen>3){
                recLen= Serial.readBytes(UART0_DMA_RXBUF,recLen);
                BspDdaRead(UART0_DMA_RXBUF,recLen);
            }
        }else{
            recLen=  Serial1.available();
            if(recLen>3){
                recLen= Serial1.readBytes(UART1_DMA_RXBUF,recLen);
                BspDdaRead(UART1_DMA_RXBUF,recLen);
            }
        }
       RtxDelay(5);
    }
}
